﻿using System;
using System.Collections.Generic;
using System.Web;

namespace CRM.BaseClass
{
    public class Common
    {
        /// <summary>
        /// 空值处理
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static string NullString(object strValue)
        {
            return (string.IsNullOrEmpty(strValue.ToString().Trim())) ? "<font color=#666666>未知..</font>" : strValue.ToString();
        }
        /// <summary>
        /// 返回用户状态
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static string UserState(object strValue,object strService)
        {
            string strState = "<font color=green>公用客户</font>";
            switch (strValue.ToString())
            {
                case "0":
                    break;
                case "1":
                    strState = "<font color=red>占用客户</font>[" + strService.ToString().Trim()+ "]";
                    break;
                case "2":
                    strState = "成交客户[" + strService.ToString().Trim() + "]";
                    break;
                default:
                    strState = "<font color=#666666>未知状态</font>";
                    break;
            }
            return strState;
        }
        /// <summary>
        /// 返回用户的等级
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static string UserLeave(object strValue)
        {
            string strLeave = "普通会员";
            switch (strValue.ToString())
            {
                case "0":
                    break;
                case"1":
                    strLeave = "<font color=red>高级会员</font>";
                    break;
                case "2":
                    strLeave = "<font color=blue>审核会员</font>";
                    break;
                case "3":
                    strLeave = "<font color=#CC9900>联盟会员</font>";
                    break;
                default:
                    strLeave = "<font color=#666666>未知等级</font>";
                    break;
            }
            return strLeave;
        }
        /// <summary>
        /// 返回用户类型
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static string UserType(object strValue)
        {
            string strType = "代理商";
            switch (strValue.ToString())
            {   
                case"0":
                    break;
                case "1":
                    strType = "<font color=green>供应商</font>";
                    break;
                default:
                    strType = "<font color=#666666>未知类型</font>";
                    break;
            }
            return strType;
        }
        /// <summary>
        /// 返回用户来源
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static string UserFrom(object strValue)
        {
            string strType = "互联网";
            switch (strValue.ToString())
            {
                case "0":
                    break;
                case "1":
                    strType = "<font color=green>地区展会</font>";
                    break;
                case "2":
                    strType = "<font color=blue>推荐介绍</font>";
                    break;
                case "3":
                    strType = "<font color=＃CC9900>其它途径</font>";
                    break;
                default:
                    strType = "<font color=#666666>未知</font>";
                    break;
            }
            return strType;
        }
        /// <summary>
        /// 返回工作状态
        /// </summary>
        /// <param name="strValue"></param>
        /// <returns></returns>
        public static string WorkState(object strValue)
        {
            string strType = "<font color=green>跟进中</font>";
            switch (strValue.ToString())
            {
                case "0":
                    break;
                case "2":
                    strType = "<font color=blue>谈判成功结束</font>";
                    break;
                case "1":
                    strType = "<font color=red>谈判失败结束</font>";
                    break;
                default:
                    strType = "<font color=green>跟进中</font>";
                    break;
            }
            return strType;
        }
    }
}
